/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package datos;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Ing. Monica Merlo, Ing. Agustin  Fernandez
 */
@Entity
@Table(name = "tipoTelefono")
@NamedQueries({@NamedQuery(name = "TipoTelefono.findAll", query = "SELECT t FROM TipoTelefono t"),
@NamedQuery(name = "TipoTelefono.findById", query = "SELECT t FROM TipoTelefono t WHERE t.id = :id"),
@NamedQuery(name = "TipoTelefono.findByTipo", query = "SELECT t FROM TipoTelefono t WHERE t.tipo = :tipo")})
public class TipoTelefono implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "tipo")
    private String tipo;
    @Lob
    @Column(name = "descripcion")
    private String descripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idTipoTelefono")
    private Collection<TelefonoPersona> telefonoPersonaCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idTipoTelefono")
    private Collection<TelefonoEmpresa> telefonoEmpresaCollection;

    public TipoTelefono() {
    }

    public TipoTelefono(Integer id) {
        this.id = id;
    }

    public TipoTelefono(Integer id, String tipo) {
        this.id = id;
        this.tipo = tipo;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Collection<TelefonoPersona> getTelefonoPersonaCollection() {
        return telefonoPersonaCollection;
    }

    public void setTelefonoPersonaCollection(Collection<TelefonoPersona> telefonoPersonaCollection) {
        this.telefonoPersonaCollection = telefonoPersonaCollection;
    }

    public Collection<TelefonoEmpresa> getTelefonoEmpresaCollection() {
        return telefonoEmpresaCollection;
    }

    public void setTelefonoEmpresaCollection(Collection<TelefonoEmpresa> telefonoEmpresaCollection) {
        this.telefonoEmpresaCollection = telefonoEmpresaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoTelefono)) {
            return false;
        }
        TipoTelefono other = (TipoTelefono) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "datos.TipoTelefono[id=" + id + "]";
    }

}
